<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>slot-具名插槽</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
  </head>

  <body>
    <div id="app">
      <con></con>
      <con><button slot="left">点击</button></con>
      <con><span slot="left">点击</span></con>
    </div>

    <template id="mycon">
      <div>
        <slot name="left">我是左侧</slot>
        <slot name="center">我是中间</slot>
        <slot name="right">我是右侧</slot>
      </div>
    </template>
    <script>
      //创建Vue实例,得到 ViewModel
      var app = new Vue({
        el: "#app",
        data: {},
        methods: {},
        components: {
          con: {
            template: "#mycon",
          },
        },
      });
    </script>
  </body>
</html>
